using DaprPlus.Settings.Domain.Entities;


namespace Todos.Infrastructure.EntityFrameworkCore.Configurations;

public class SettingDefinitionConfiguration : EntityConfigurationBase<SettingDefinition>
{
    /// <summary>
    /// 重写以实现实体类型各个属性的数据库配置
    /// </summary>
    /// <param name="builder">实体类型创建器</param>
    public override void Configure(EntityTypeBuilder<SettingDefinition> builder)
    {

        builder.Property(m => m.Name).IsRequired().HasMaxLength(200);
        builder.Property(m => m.TypeName).IsRequired().HasMaxLength(500);
        builder.Property(m => m.Remark).HasMaxLength(500);

        builder.HasMany(m => m.Items).WithOne().HasForeignKey(m => m.SettingDefinitionId).IsRequired(false);
    }
}
